Getelementbyid getelementsbyname getelementsbytagname
Getelementbyid obtains the node through the ID attribute of the node. This object contains attributes such as nodename, nodetype, parentnode, and childnodes.
Nodename indicates the node name. If
As a js-DOM developer, you must know some DOM methods:1. Create a node.CreateElement ():Var a = document. createElement ("p ");It creates an element node, so nodeType is equal to 1.A. nodeName will return p;Note: The new element node created by the
Most of the information that can be found on the Internet is that createDocumentFragment is used mainly because it avoids the efficiency problem caused by multiple times of adding createElement to document. body. For example:
Copy codeThe Code is as
When analyzing the code, I found my blind spot-document. createelement (), surfing, and summed up some experience.
Document. createelement () is to create an object in the object, with the appendchild () orThe insertbefore () method is used
AnalysisCodeFind your own blind spot-document. createelement (), surf and summarize some experience.
Document. createelement () is an object created in the object. It must be used together with the appendchild () or insertbefore () method. The
This article mainly introduces that IE9 + has no document. createElement downward compatible solution. If you need a friend, you can refer to the following today and find that the functions on the pages of IE9 and chrome are different. Therefore,
This article mainly introduces that IE9 + has no document. createElement downward compatible solution. if you need a friend, you can refer to the following today and find that the functions on the pages of IE9 and chrome are different. therefore,
Document. createElement () is an object created in the object. It must be used together with the appendChild () or insertBefore () method. The appendChild () method adds a new subnode at the end of the subnode list of the node. The insertBefore ()
Most of the internet can be found that the use of createdocumentfragment mainly because of avoiding createelement multiple times added to the document.body caused by efficiency problems, such as:
Copy Code code as follows:
var
Reference: http://hi.baidu.com/xcb521/blog/item/2ac50dc6253c79d6d1006073.html
Here, Baidu access statistics code constructor is decoded as an example:
Baidu access statistics code JavaScript source code:The red and bold parts will be modified.Eval
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.